/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package tuneViews;

import javax.swing.JCheckBoxMenuItem;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JMenuItem;
import javax.swing.JTable;

/**
 *
 * @author Israel Agyeman-Premp
 */
public class PlayerApp extends javax.swing.JFrame {

    /**
     * Creates new form for the player
     */
    public PlayerApp() {
        initComponents();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        volume = new javax.swing.JLabel();
        quickOpen = new javax.swing.JLabel();
        play = new javax.swing.JLabel();
        pause = new javax.swing.JLabel();
        logo = new javax.swing.JLabel();
        powerOff = new javax.swing.JLabel();
        displayTrack = new javax.swing.JLabel();
        jToolBar1 = new javax.swing.JToolBar();
        search = new javax.swing.JComboBox();
        stop = new javax.swing.JLabel();
        jPanel1 = new javax.swing.JPanel();
        jPanel2 = new javax.swing.JPanel();
        jScrollPane1 = new javax.swing.JScrollPane();
        trackTable = new javax.swing.JTable();
        bg = new javax.swing.JLabel();
        jMenuBar2 = new javax.swing.JMenuBar();
        connect = new javax.swing.JMenu();
        openMusic = new javax.swing.JMenuItem();
        themes = new javax.swing.JMenu();
        defaultTheme = new javax.swing.JCheckBoxMenuItem();
        blackTheme = new javax.swing.JCheckBoxMenuItem();
        pinkTheme = new javax.swing.JCheckBoxMenuItem();
        ashesiTheme = new javax.swing.JCheckBoxMenuItem();
        aquaTheme = new javax.swing.JCheckBoxMenuItem();
        export = new javax.swing.JMenuItem();
        report = new javax.swing.JMenuItem();
        openMini = new javax.swing.JMenuItem();
        jMenu7 = new javax.swing.JMenu();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setMaximumSize(new java.awt.Dimension(800, 300));
        setMinimumSize(new java.awt.Dimension(800, 300));
        setUndecorated(true);
        getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        volume.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/volume-down.png"))); // NOI18N
        getContentPane().add(volume, new org.netbeans.lib.awtextra.AbsoluteConstraints(540, 20, -1, 30));

        quickOpen.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/quick-open.png"))); // NOI18N
        getContentPane().add(quickOpen, new org.netbeans.lib.awtextra.AbsoluteConstraints(510, 20, -1, 30));

        play.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/play-01.png"))); // NOI18N
        play.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                playMouseClicked(evt);
            }
        });
        getContentPane().add(play, new org.netbeans.lib.awtextra.AbsoluteConstraints(60, 0, -1, 70));

        pause.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/pause-01.png"))); // NOI18N
        pause.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                pauseMouseClicked(evt);
            }
        });
        getContentPane().add(pause, new org.netbeans.lib.awtextra.AbsoluteConstraints(120, 0, -1, 70));

        logo.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/logo-1.png"))); // NOI18N
        getContentPane().add(logo, new org.netbeans.lib.awtextra.AbsoluteConstraints(590, 10, -1, 20));

        powerOff.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/off.png"))); // NOI18N
        powerOff.setText("jLabel1");
        powerOff.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                powerOffMouseClicked(evt);
            }
        });
        getContentPane().add(powerOff, new org.netbeans.lib.awtextra.AbsoluteConstraints(170, 10, 40, 60));

        displayTrack.setFont(new java.awt.Font("Champagne & Limousines", 1, 22)); // NOI18N
        displayTrack.setForeground(new java.awt.Color(0, 0, 0));
        displayTrack.setText("Open A File to Play");
        getContentPane().add(displayTrack, new org.netbeans.lib.awtextra.AbsoluteConstraints(240, 20, 270, 30));

        jToolBar1.setBorder(null);
        jToolBar1.setRollover(true);

        search.setEditable(true);
        jToolBar1.add(search);

        getContentPane().add(jToolBar1, new org.netbeans.lib.awtextra.AbsoluteConstraints(590, 30, 140, 20));

        stop.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/stop-01.png"))); // NOI18N
        stop.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                stopMouseClicked(evt);
            }
        });
        getContentPane().add(stop, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 0, -1, 70));

        jPanel1.setLayout(new javax.swing.BoxLayout(jPanel1, javax.swing.BoxLayout.LINE_AXIS));

        jPanel2.setLayout(new java.awt.GridLayout(1, 0));

        trackTable.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Empty", "Empty", "Empty", "Empty"
            }
        ) {
            boolean[] canEdit = new boolean [] {
                false, false, false, false
            };

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        trackTable.setMaximumSize(new java.awt.Dimension(600, 64));
        trackTable.setMinimumSize(new java.awt.Dimension(600, 64));
        jScrollPane1.setViewportView(trackTable);

        jPanel2.add(jScrollPane1);

        jPanel1.add(jPanel2);

        getContentPane().add(jPanel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 70, 800, 220));

        bg.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/UI-01-01.png"))); // NOI18N
        bg.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mousePressed(java.awt.event.MouseEvent evt) {
                bgMousePressed(evt);
            }
        });
        bg.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() {
            public void mouseDragged(java.awt.event.MouseEvent evt) {
                bgMouseDragged(evt);
            }
        });
        getContentPane().add(bg, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, -1, -1));

        jMenuBar2.setBackground(new java.awt.Color(0, 0, 0));
        jMenuBar2.setAlignmentX(10.0F);

        connect.setBackground(new java.awt.Color(0, 0, 0));
        connect.setText("File");

        openMusic.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_O, java.awt.event.InputEvent.CTRL_MASK));
        openMusic.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/open-music.png"))); // NOI18N
        openMusic.setText("Open ");
        openMusic.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                openMusicActionPerformed(evt);
            }
        });
        connect.add(openMusic);

        themes.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/themes.png"))); // NOI18N
        themes.setText("Themes");

        defaultTheme.setText("Default");
        defaultTheme.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                defaultThemeActionPerformed(evt);
            }
        });
        themes.add(defaultTheme);

        blackTheme.setText("Black Beauty");
        themes.add(blackTheme);

        pinkTheme.setText("Pink");
        themes.add(pinkTheme);

        ashesiTheme.setText("Ashesi");
        ashesiTheme.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ashesiThemeActionPerformed(evt);
            }
        });
        themes.add(ashesiTheme);

        aquaTheme.setText("Aqua");
        themes.add(aquaTheme);

        connect.add(themes);

        export.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_E, java.awt.event.InputEvent.CTRL_MASK));
        export.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/export.png"))); // NOI18N
        export.setText("Export");
        export.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                exportActionPerformed(evt);
            }
        });
        connect.add(export);

        report.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/report.png"))); // NOI18N
        report.setText("History");
        report.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                reportActionPerformed(evt);
            }
        });
        connect.add(report);

        openMini.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_1, java.awt.event.InputEvent.SHIFT_MASK | java.awt.event.InputEvent.CTRL_MASK));
        openMini.setText("Mini Player");
        openMini.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                openMiniActionPerformed(evt);
            }
        });
        connect.add(openMini);

        jMenuBar2.add(connect);

        jMenu7.setBackground(new java.awt.Color(0, 0, 0));
        jMenu7.setText("Edit");
        jMenuBar2.add(jMenu7);

        setJMenuBar(jMenuBar2);

        pack();
        setLocationRelativeTo(null);
    }// </editor-fold>//GEN-END:initComponents

    private void stopMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_stopMouseClicked
        // TODO add your handling code here:
    }//GEN-LAST:event_stopMouseClicked

    private void playMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_playMouseClicked
        // TODO add your handling code here:
    }//GEN-LAST:event_playMouseClicked

    private void pauseMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_pauseMouseClicked
        // TODO add your handling code here:
    }//GEN-LAST:event_pauseMouseClicked

    private void powerOffMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_powerOffMouseClicked
        // TODO add your handling code here:
    }//GEN-LAST:event_powerOffMouseClicked

    private void bgMouseDragged(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_bgMouseDragged
        // TODO add your handling code here:
        int x = evt.getXOnScreen();
        int y = evt.getYOnScreen();
        this.setLocation(x-xMouse,y-yMouse);
    }//GEN-LAST:event_bgMouseDragged

    /**
     * This code has two parameters, xMouse and yMouse which allow you to drag the
     * JApplet around. Because the close buttons have been removed, it is necessary to have this
     * to allow free dragging
     * @param evt 
     */
    private void bgMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_bgMousePressed
        // TODO add your handling code here:
        xMouse = evt.getX();
        yMouse = evt.getY();
    }//GEN-LAST:event_bgMousePressed

    private void defaultThemeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_defaultThemeActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_defaultThemeActionPerformed

    private void exportActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_exportActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_exportActionPerformed

    private void openMusicActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_openMusicActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_openMusicActionPerformed

    private void ashesiThemeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ashesiThemeActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_ashesiThemeActionPerformed

    private void reportActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_reportActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_reportActionPerformed

    private void openMiniActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_openMiniActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_openMiniActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(PlayerApp.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(PlayerApp.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(PlayerApp.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(PlayerApp.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>
        //</editor-fold>
        //</editor-fold>
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new PlayerApp().setVisible(true);
            }
        });
    }
     /**
     * A list of all UI elements returned to the controller
     * 
    */
    
   
    
    /**
     * Return the stop button to the PlayerController
     * @return JLabel
     */
    public JLabel stopBtn(){
        return stop;
    }
    
    /**
     * Return the play button to the PlayerController
     * @return JLabel
     */
    public JLabel playBtn(){
        return play;
    }
    
    /**
     * Return the pause button to the PlayerController
     * @return JLabel
     */
    public JLabel pauseBtn(){
        return pause;
    }
    
     /**
     * Return the pause button to the PlayerController
     * @return JLabel
     */
    public JLabel powerBtn(){
        return powerOff;
    }
    
    /**
     * Return the JTable to the PlayerController
     * @return JTable
     */
    public JTable getTable(){
        return trackTable;
    }
    
    
     /**
     * Return the background of the JLabel which makes up the UI to 
     * The PlayerController
     * @return JLabel
     */
    public JLabel getBg(){
        return bg;
    }
    
       /**
     * Return the area that displays the currently playing track
     * @return JLabel
     */
    public JLabel displayTrack(){
        return displayTrack;
    }
    
    
    
     /**
     * Return the open menuItem which allows a user to choose a file
     * @return JMenuItem
     */
    public JMenuItem openMusic(){
        return openMusic;
    }
   
    
    /**
     * Return the themes menuItem which allows the user to change themes
     * @return JMenuItem
     */
    public JMenuItem themes(){
        return themes;
    }
    
     /**
     * Return the export menuItem which exports a list of all songs played
     * @return JMenuItem
     */
    public JMenuItem export(){
        return export;
    }
    
     /**
     * Return the playlist menuItem this returns the history menu Item
     * @return JMenuItem
     */
    public JMenuItem report(){
        return report;
    }
    
     /**
     * Return the mini player
     * @return JMenuItem
     */
    public JMenuItem miniPlayer(){
        return openMini;
    }
     /**
     * Return a list of individual checked themes to allow theme changing
     * @return JCheckBoxMenuItem
     */
    public JCheckBoxMenuItem defaultTheme(){
        return defaultTheme;
    }
    
     /**
     * Return the individual checked themes (Black Theme) 
     * @return JCheckBoxMenuItem
     */
    public JCheckBoxMenuItem blackTheme(){
        return blackTheme;
    }
    
     /**
     * Return the individual checked themes (Pink Theme)
     * @return JCheckBoxMenuItem
     */
    public JCheckBoxMenuItem pinkTheme(){
        return pinkTheme;
    }
    
    /**
     * Return the individual checked themes (Ashesi Theme)
     * @return JCheckBoxMenuItem
     */
    public JCheckBoxMenuItem ashesiTheme(){
        return ashesiTheme;
    }
    
    /**
     * Return the individual checked themes (Aqua Theme)
     * @return JCheckBoxMenuItem
     */
    public JCheckBoxMenuItem aquaTheme(){
        return aquaTheme;
    }
    
  
    
    /**
     * A TextField that returns the search component
     * which is a combo box
    *
     * @return 
    */
    public JComboBox search(){
        return search;
    }
    
    /**
    *A method that returns the quickOpen button on the HUB
     * @return 
    */
    public JLabel quickOpen(){
        return quickOpen;
    }
    
    /**
    *A method that returns the volume button to adjust volume
     * @return 
    */
    public JLabel volume(){
        return volume;
    }
    
    
private int xMouse,yMouse;

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JCheckBoxMenuItem aquaTheme;
    private javax.swing.JCheckBoxMenuItem ashesiTheme;
    private javax.swing.JLabel bg;
    private javax.swing.JCheckBoxMenuItem blackTheme;
    private javax.swing.JMenu connect;
    private javax.swing.JCheckBoxMenuItem defaultTheme;
    private javax.swing.JLabel displayTrack;
    private javax.swing.JMenuItem export;
    private javax.swing.JMenu jMenu7;
    private javax.swing.JMenuBar jMenuBar2;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JToolBar jToolBar1;
    private javax.swing.JLabel logo;
    private javax.swing.JMenuItem openMini;
    private javax.swing.JMenuItem openMusic;
    private javax.swing.JLabel pause;
    private javax.swing.JCheckBoxMenuItem pinkTheme;
    private javax.swing.JLabel play;
    private javax.swing.JLabel powerOff;
    private javax.swing.JLabel quickOpen;
    private javax.swing.JMenuItem report;
    private javax.swing.JComboBox search;
    private javax.swing.JLabel stop;
    private javax.swing.JMenu themes;
    private javax.swing.JTable trackTable;
    private javax.swing.JLabel volume;
    // End of variables declaration//GEN-END:variables
}
